import { list, enabledControl, customerList,
    saveJournal, getJournalById, bindJournalToPoint,
    getJoPoint, removeJoPoint, xstatusControl,
    getJournalMaxLimit } from '@/services/journal/journalService';

export default {
    namespace: 'journalModel',

    state: {},

    effects: {
        *list({ payload, callback }, { call, put }) {
            const response = yield call(list, payload);
            if(callback) callback(response);
        },
        *enabledControl({ payload, callback }, { call, put }) {
            const response = yield call(enabledControl, payload);
            if(callback) callback(response);
        },
        *customerList({ payload, callback }, { call, put }) {
            const response = yield call(customerList, payload);
            if(callback) callback(response);
        },
        *saveJournal({ payload, callback }, { call, put }) {
            const response = yield call(saveJournal, payload);
            if(callback) callback(response);
        },
        *getJournalById({ payload, callback }, { call, put }) {
            const response = yield call(getJournalById, payload);
            if(callback) callback(response);
        },
        *bindJournalToPoint({ payload, callback }, { call, put }) {
            const response = yield call(bindJournalToPoint, payload);
            if(callback) callback(response);
        },
        *getJoPoint({ payload, callback }, { call, put }) {
            const response = yield call(getJoPoint, payload);
            if(callback) callback(response);
        },
        *removeJoPoint({ payload, callback }, { call, put }) {
            const response = yield call(removeJoPoint, payload);
            if(callback) callback(response);
        },
        *xstatusControl({ payload, callback }, { call, put }) {
            const response = yield call(xstatusControl, payload);
            if(callback) callback(response);
        },
        *getJournalMaxLimit({ payload, callback }, { call, put }) {
            const response = yield call(getJournalMaxLimit, payload);
            if(callback) callback(response);
        },
    },

    reducers: {
    },
};
